<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="true"><block slot="backText">返回</block>
			<block slot="content">到访客户详情</block>
		</cu-custom>
		
		<view class="cu-form-group">
			<view class="title">姓名</view>
			<view class="title">{{res.userName}}</view>
		</view>
		
		<view class="cu-form-group">
			<view class="title">手机号</view>
			<view class="title">{{res.phone}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.sex != null">
			<view class="title">性别</view>
			<view class="title" v-if="res.sex == 1">男</view>
			<view class="title" v-if="res.sex == 2">女</view>
		</view>
		
		<view class="cu-form-group" v-if="res.isMembers != null">
			<view class="title">是否是会员</view>
			<view class="title" v-if="res.isMembers == 1">是</view>
			<view class="title" v-if="res.isMembers == 2">不是</view>
		</view>
		
		<view class="cu-form-group" v-if="res.createTime != null">
			<view class="title">访客到店时间</view>
			<view class="title">{{res.createTime}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.courseName != null">
			<view class="title">上课名称</view>
			<view class="title">{{res.courseName}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.courseDate != null">
			<view class="title">上课时间</view>
			<view class="title">{{res.courseDate}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.courseCard != null">
			<view class="title">会员卡名称</view>
			<view class="title">{{res.courseCard}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.referees != null">
			<view class="title">推荐人</view>
			<view class="title">{{res.referees}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.remark != null">
			<view class="title">备注</view>
			<view class="title">{{res.remark}}</view>
		</view>
		
		<view class="cu-form-group" v-if="res.advice != null">
			<view class="title">建议</view>
			<view class="title">{{res.advice}}</view>
		</view>
		
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res: {},
				id:'',
				openid:'',
			}
		},
		onLoad(e) {
			this.id = e.id
			let that = this;
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					that.openid = res.data
					that.setajax()
			 },
			 fail: () => {
			 }
			});
		},
		methods: {
			setajax(){
				var data = {
					'id': this.id,
				}
				uni.request({
					url: 'https://jxjsservice.jxfit.cn/coach/visitors/getVisitorsRecordById',
					method: 'GET',
					data: data,
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
						this.res = res.data.datas
					},
					fail: () => {},
					complete: () => {}
				});
			},
		}
	}
</script>

<style>
</style>
